{extend name="base"}
{block name="pageBody"}
<section class="content-wrapper">
	<div class="content-container container">
		<div class="main">
			<h1 class="page-title">登录 或 创建新账号</h1>
			<div class="account-login">
				<div class="col-1 new-users">
					<div class="content">
						<h2>新客户</h2>
						<p>您必须在创建用户后才能享受本网站更多的服务</p>
						<p>《用户须知》</p>
						<p>1.用户名不能重复</p>
						<p>2.登录时使用注册邮箱登录</p>
						<p>3.不能同时登陆两个用户</p>
						<p>4.不知道说啥了</p>
						<p>5.最终解释权归本网站所有</p>
					</div>
					<div class="buttons-set">
						<a class="colors-btn" style="background-color: #ff7744" href="register.html">创建账户</a>
						<div class="clear"></div>
					</div>
				</div>
				<div class="col-2 registered-users">
					<div class="content">
						<h2>已有账户</h2>
						<p>如果您已有账户，请您登录.</p>
						<form id="user_login" onsubmit="return false">
						<ul class="form-list">
							<li>
								<label class="required" for="email">邮箱<em>*</em></label>
								<div class="input-box">
									<input type="email" name="user_email" placeholder="邮箱" required>
								</div>
								<div class="clear"></div>
							</li>
							<li>
								<label class="required" for="pass">密码<em>*</em></label>
								<div class="input-box">
									<input type="password" name="user_password" placeholder="密码" required>
								</div>
								<div class="clear"></div>
							</li>
							<li>
								<label class="remember-me"><input name="rm" type="checkbox"> 记住我</label>
							</li>
						</ul>
					</div>
					<div class="buttons-set">
						<a class="f-left" href="{:url('resetPass')}">忘记密码?</a>
						<input class="colors-btn" value="登录" style="background-color:#5599ff" type="submit" onclick="login()">
						<div class="clear"></div>
					</div>
					</form>
            	</div>
				<div class="clear"></div>
			</div>
		</div>
		<div class="clearfix"></div>
		<div class="news-letter-container">
			<div class="free-shipping-block">
				<h1>ENJOY FREE SHIPPING</h1>
				<p>on all orders as our holiday gift for you!</p>
			</div>
		</div>	
	</div>
</section>

<script>
	function login(){
      var form = new FormData(document.getElementById("user_login"));
      $.ajax({
          url:"{:url('userdo/Login')}",
          type:"post",
          data:form,
          processData: false,                // jQuery不要去处理发送的数据
          contentType: false,
          dataType: 'json',
                success:function(data){
                    if (0 == data.code){
                    	window.location.href="index?category_id=1";
                    }else{
                      	alert(data.msg);
                    }
                }
            }); 
    }
</script>
{/block}